import { Component, OnInit, Input, Output, DoCheck, EventEmitter } from '@angular/core';

@Component({
  selector: 'app-detail',
  templateUrl: './detail.component.html',
  styleUrls: ['./detail.component.scss']
})
export class DetailComponent implements OnInit {

  constructor() { }

  @Input() data: any;
  @Output('checked') checkedBack = new EventEmitter<any>();
  name: any = "";

  num: number = 100;
  public color:string;
  ngOnInit(): void {
    console.log(this.data)

    setInterval(() => {
      this.num++;
      console.log(this.num)
    }, 3000)
  }

  ngDoCheck(){
    this.Add(this.num);
  }

  ngOnChanges() {
    console.log('自动改变',this.data)

    



  }

  Add(num: number) {
    console.log('我在改变', num)
  }

  Update() {

    this.checkedBack.emit(this.name);
  }

}
